#!/bin/bash
dt=`date +%Y%m%d`
find /root/backup/etcd-backup/ -name "*.db" -mtime +15 -exec rm -f {} \;
cp -rf /etc/kubernetes /root/backup/
export ETCDCTL_API=3
/usr/local/bin/etcdctl --endpoints=127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/apiserver-etcd-client.key --cert=/etc/kubernetes/pki/apiserver-etcd-client.crt snapshot save /root/backup/etcd-backup/etcd-snapshot_$dt.db \
#&& scp -r /root/backup/etcd-backup/etcd-snapshot_$dt.db xxx@xxx:/ 
#scp -r /root/backup/kubernetes xxx@xxx:/
